package cn.edu.nit.sys.utils;

import cn.edu.nit.sys.mapper.UserMapper;
import cn.edu.nit.sys.service.MessageService;
import cn.edu.nit.sys.service.NoticeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;

/**
 * @Author xiaobai
 * @Date 2022/11/6 0:03
 * @Version 1.0.0
 */
@Component
public class SpringBeanUtils {

    @Autowired
    private RedisTemplate<String, Object> rs;

    @Autowired
    private MessageService ms;

    @Autowired
    private NoticeService ns;

    @Autowired
    private UserMapper up;

    public static RedisTemplate<String, Object> redisTemplate;
    public static MessageService messageService;
    public static NoticeService noticeService;
    public static UserMapper userMapper;

    @PostConstruct
    public void getRedisTemplate() {
        redisTemplate = this.rs;
    }

    @PostConstruct
    public void getMessageService() {
        messageService = this.ms;
    }

    @PostConstruct
    public void getNoticeService() {
        noticeService = this.ns;
    }

    @PostConstruct
    public void getUserMapper() { userMapper = this.up; }
}
